#pragma once

#include "Core/Netplay/GameClient.h"
#include "Core/Netplay/GameServer.h"
#include "Core/Shared/CheatManager.h"
#include "Core/Shared/DebuggerRequest.h"
#include "Core/Shared/EmuSettings.h"
#include "Core/Shared/Emulator.h"
#include "Core/Shared/Interfaces/INotificationListener.h"
#include "Core/Shared/KeyManager.h"
#include "Core/Shared/MessageManager.h"
#include "Core/Shared/SaveStateManager.h"
#include "Core/Shared/ShortcutKeyHandler.h"
#include "Core/Shared/SystemActionManager.h"
#include "Core/Shared/TimingInfo.h"
#include "Core/Shared/Video/VideoDecoder.h"
#include "Core/Shared/Video/VideoRenderer.h"
#include "Utilities/ArchiveReader.h"
#include "Utilities/FolderUtilities.h"
#include "Utilities/StringUtilities.h"

#include "minisoundmanager.h"
#include "qkeymanager.h"
#include "qmousemanager.h"
#include "qpicturebox.h"
#include "qrender.h"
#include "qsettingsdialog.h"

#include <QAction>
#include <QLabel>
#include <QMainWindow>
#include <QThread>
#include <qobject.h>

class MainWindowPrivate;

class MainWindow : public QMainWindow
{
    Q_OBJECT
public:
    explicit MainWindow(QWidget *parent = nullptr);
    ~MainWindow() override;

Q_SIGNALS:
    void emulatorStarted();
    void emulatorStopped();
    void recentGameAdded(const QString &romPath);

private:
    Emulator *m_emulator = nullptr;
    QThread *m_emuThread = nullptr;
    QPictureBox *m_pictureBox = nullptr;

    QRender *m_qRender = nullptr;
    QMouseManager *m_qMouseManager = nullptr;
    QKeyManager *m_qKeyManager = nullptr;
    MiniSoundManager *m_miniSoundManager = nullptr;
    QSettingsDialog *m_settingsDialog = nullptr;

    QLabel *m_fpsLabel = nullptr;
    QString m_dataBasePath;

    MainWindowPrivate *p = nullptr;

    void initEmulator();
    void initUI();
    void openRomFile();

protected:
    void resizeEvent(QResizeEvent *event) override;
};
